<%@page import="com.mbbmap.util.EncryptionHelper"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ page import = "org.json.simple.*, com.classes.Casemast" %>
<%@ page import = "com.mbbmap.util.Constants" %>
<%@ page import = "com.mbbmap.security.dao.*" %>
<%@ include file="/jsp/map/include/user-dao.jsp" %>
<%
int merchant_id = Integer.parseInt(request.getAttribute("merchant_id").toString());
int case_id = Integer.parseInt(request.getAttribute("case_id").toString());

JSONObject document_checklist = new JSONObject();
JSONObject general = new JSONObject();
JSONObject private_limited = new JSONObject();
JSONObject sole_proprietor_partnership = new JSONObject();
JSONObject clinic = new JSONObject();
JSONObject jmb = new JSONObject();
JSONObject law_firm = new JSONObject();
JSONObject association = new JSONObject();

String business_type = "";

if(request.getAttribute("m_case") != null) {
	Casemast m_case = (Casemast) request.getAttribute("m_case");
	
	if(m_case.getDocumentChecklist().length() > 0){
		document_checklist = (JSONObject) JSONValue.parse(m_case.getDocumentChecklist());
	}
	
	business_type = document_checklist.get("business_type") == null ? "" : document_checklist.get("business_type").toString();
	
	if(document_checklist.get("general") != null){
		general = (JSONObject) document_checklist.get("general");
	}
	
	if(document_checklist.get("private_limited") != null){
		private_limited = (JSONObject) document_checklist.get("private_limited");
	}
	
	if(document_checklist.get("sole_proprietor_partnership") != null){
		sole_proprietor_partnership = (JSONObject) document_checklist.get("sole_proprietor_partnership");
	}
	
	if(document_checklist.get("clinic") != null){
		clinic = (JSONObject) document_checklist.get("clinic");
	}
	
	if(document_checklist.get("jmb") != null){
		jmb = (JSONObject) document_checklist.get("jmb");
	}
	
	if(document_checklist.get("law_firm") != null){
		law_firm = (JSONObject) document_checklist.get("law_firm");
	}
	
	if(document_checklist.get("association") != null){
		association = (JSONObject) document_checklist.get("association");
	}
}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<jsp:include page="include/html-meta.jsp" />
<title>MAYBANK</title>
<script src="<%= request.getContextPath() %>/js/merchant.js"></script>
</head>
<body onload="merchant.document_checklist_load()">

<!-- Header -->
<%@ include file="/jsp/common/Header.jsp" %>	
<!-- End Header -->

<div class="row-fluid page">
	<div class="span12">
		
		<jsp:include page="include/tab.jsp">
			
			<jsp:param name="active" value='<%=EncryptionHelper.encrypt("document") %>' />
		</jsp:include>
		
		<jsp:include page="/jsp/map/include/document-tab.jsp">
			
			<jsp:param name="active" value='<%=EncryptionHelper.encrypt("document_checklist") %>' />
		</jsp:include>
		
		<form class="form-horizontal" name="form">
			<input type="hidden" name="<%= Constants.TOKEN_KEY %>" value="<%= session.getAttribute(Action.TRANSACTION_TOKEN_KEY) %>" >
			<table class="tbl general" style="width:auto; margin-bottom:30px"><thead>
				<tr>
					<th style="width:90px">Not Required</th>
					<th style="width:70px">Available</th>
					<th>Document Name</th>
				</tr>
			</thead><tbody>
				<tr data-name="Approval Paper">
					<% 
						String checked = "";
						String checked2 = "";
						String name = "Approval Paper";
						JSONObject item = null;
						
						if(general.get(name) != null){
							item = (JSONObject) general.get(name);
							
							if(item.get("not_required").toString().equals("Y")){
								checked = "checked ";
							}
							
							if(item.get("available").toString().equals("Y")){
								checked2 = "checked ";
							}
						}
					%>
					<td class="not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
					<td class="available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
					<td>Approval Paper</td>
				</tr>
				<tr data-name="Letter of Acceptance/Letter of Offer">
					<% 
						checked = "";
						checked2 = "";
						name = "Letter of Acceptance/Letter of Offer";
						item = null;
						
						if(general.get(name) != null){
							item = (JSONObject) general.get(name);
							
							if(item.get("not_required").toString().equals("Y")){
								checked = "checked ";
							}
							
							if(item.get("available").toString().equals("Y")){
								checked2 = "checked ";
							}
						}
					%>
					<td class="not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
					<td class="available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
					<td>Letter of Acceptance/Letter of Offer</td>
				</tr>
				<tr data-name="Merchant Application Form">
					<% 
						checked = "";
						checked2 = "";
						name = "Merchant Application Form";
						item = null;
						
						if(general.get(name) != null){
							item = (JSONObject) general.get(name);
							
							if(item.get("not_required").toString().equals("Y")){
								checked = "checked ";
							}
							
							if(item.get("available").toString().equals("Y")){
								checked2 = "checked ";
							}
						}
					%>
					<td class="not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
					<td class="available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
					<td>Merchant Application Form</td>
				</tr>
				<tr data-name="Business License">
					<% 
						checked = "";
						checked2 = "";
						name = "Business License";
						item = null;
						
						if(general.get(name) != null){
							item = (JSONObject) general.get(name);
							
							if(item.get("not_required").toString().equals("Y")){
								checked = "checked ";
							}
							
							if(item.get("available").toString().equals("Y")){
								checked2 = "checked ";
							}
						}
					%>
					<td class="not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
					<td class="available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
					<td>Business License</td>
				</tr>
				<tr data-name="Site photos (outside with signboard)">
					<% 
						checked = "";
						checked2 = "";
						name = "Site photos (outside with signboard)";
						item = null;
						
						if(general.get(name) != null){
							item = (JSONObject) general.get(name);
							
							if(item.get("not_required").toString().equals("Y")){
								checked = "checked ";
							}
							
							if(item.get("available").toString().equals("Y")){
								checked2 = "checked ";
							}
						}
					%>
					<td class="not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
					<td class="available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
					<td>Site photos (outside with signboard)</td>
				</tr>
				<tr data-name="Site photos (inside premise)">
					<% 
						checked = "";
						checked2 = "";
						name = "Site photos (inside premise)";
						item = null;
						
						if(general.get(name) != null){
							item = (JSONObject) general.get(name);
							
							if(item.get("not_required").toString().equals("Y")){
								checked = "checked ";
							}
							
							if(item.get("available").toString().equals("Y")){
								checked2 = "checked ";
							}
						}
					%>
					<td class="not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
					<td class="available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
					<td>Site photos (inside premise)</td>
				</tr>
				<tr data-name="Terminal Deposit">
					<% 
						checked = "";
						checked2 = "";
						name = "Terminal Deposit";
						item = null;
						
						if(general.get(name) != null){
							item = (JSONObject) general.get(name);
							
							if(item.get("not_required").toString().equals("Y")){
								checked = "checked ";
							}
							
							if(item.get("available").toString().equals("Y")){
								checked2 = "checked ";
							}
						}
					%>
					<td class="not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
					<td class="available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
					<td>Terminal Deposit</td>
				</tr>
				<tr data-name="Terminal Rental Deposit">
					<% 
						checked = "";
						checked2 = "";
						name = "Terminal Rental Deposit";
						item = null;
						
						if(general.get(name) != null){
							item = (JSONObject) general.get(name);
							
							if(item.get("not_required").toString().equals("Y")){
								checked = "checked ";
							}
							
							if(item.get("available").toString().equals("Y")){
								checked2 = "checked ";
							}
						}
					%>
					<td class="not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
					<td class="available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
					<td>Terminal Rental Deposit</td>
				</tr>
				<tr data-name="Advance Terminal Rental">
					<% 
						checked = "";
						checked2 = "";
						name = "Advance Terminal Rental";
						item = null;
						
						if(general.get(name) != null){
							item = (JSONObject) general.get(name);
							
							if(item.get("not_required").toString().equals("Y")){
								checked = "checked ";
							}
							
							if(item.get("available").toString().equals("Y")){
								checked2 = "checked ";
							}
						}
					%>
					<td class="not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
					<td class="available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
					<td>Advance Terminal Rental</td>
				</tr>
				<tr data-name="Amex Tag On Fee">
					<% 
						checked = "";
						checked2 = "";
						name = "Amex Tag On Fee";
						item = null;
						
						if(general.get(name) != null){
							item = (JSONObject) general.get(name);
							
							if(item.get("not_required").toString().equals("Y")){
								checked = "checked ";
							}
							
							if(item.get("available").toString().equals("Y")){
								checked2 = "checked ";
							}
						}
					%>
					<td class="not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
					<td class="available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
					<td>Amex Tag On Fee</td>
				</tr>
				<tr data-name="Financial Checking">
					<% 
						checked = "";
						checked2 = "";
						name = "Financial Checking";
						item = null;
						
						if(general.get(name) != null){
							item = (JSONObject) general.get(name);
							
							if(item.get("not_required").toString().equals("Y")){
								checked = "checked ";
							}
							
							if(item.get("available").toString().equals("Y")){
								checked2 = "checked ";
							}
						}
					%>
					<td class="not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
					<td class="available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
					<td>Financial Checking</td>
				</tr>
				<tr data-name="MATCH/TRACE result">
					<% 
						checked = "";
						checked2 = "";
						name = "MATCH/TRACE result";
						item = null;
						
						if(general.get(name) != null){
							item = (JSONObject) general.get(name);
							
							if(item.get("not_required").toString().equals("Y")){
								checked = "checked ";
							}
							
							if(item.get("available").toString().equals("Y")){
								checked2 = "checked ";
							}
						}
					%>
					<td class="not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
					<td class="available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
					<td>MATCH/TRACE result</td>
				</tr>
				<tr data-name="RMS Comments">
					<% 
						checked = "";
						checked2 = "";
						name = "RMS Comments";
						item = null;
						
						if(general.get(name) != null){
							item = (JSONObject) general.get(name);
							
							if(item.get("not_required").toString().equals("Y")){
								checked = "checked ";
							}
							
							if(item.get("available").toString().equals("Y")){
								checked2 = "checked ";
							}
						}
					%>
					<td class="not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
					<td class="available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
					<td>RMS Comments</td>
				</tr>
				<tr data-name="Letter of Guarantee & NRIC of Guarantors">
					<% 
						checked = "";
						checked2 = "";
						name = "Letter of Guarantee & NRIC of Guarantors";
						item = null;
						
						if(general.get(name) != null){
							item = (JSONObject) general.get(name);
							
							if(item.get("not_required").toString().equals("Y")){
								checked = "checked ";
							}
							
							if(item.get("available").toString().equals("Y")){
								checked2 = "checked ";
							}
						}
					%>
					<td class="not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
					<td class="available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
					<td>Letter of Guarantee & NRIC of Guarantors</td>
				</tr>
				<tr data-name="3 Months Bank Statements">
					<% 
						checked = "";
						checked2 = "";
						name = "3 Months Bank Statements";
						item = null;
						
						if(general.get(name) != null){
							item = (JSONObject) general.get(name);
							
							if(item.get("not_required").toString().equals("Y")){
								checked = "checked ";
							}
							
							if(item.get("available").toString().equals("Y")){
								checked2 = "checked ";
							}
						}
					%>
					<td class="not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
					<td class="available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
					<td>3 Months Bank Statements</td>
				</tr>
				<tr data-name="Branch Recommendation">
					<% 
						checked = "";
						checked2 = "";
						name = "Branch Recommendation";
						item = null;
						
						if(general.get(name) != null){
							item = (JSONObject) general.get(name);
							
							if(item.get("not_required").toString().equals("Y")){
								checked = "checked ";
							}
							
							if(item.get("available").toString().equals("Y")){
								checked2 = "checked ";
							}
						}
					%>
					<td class="not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
					<td class="available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
					<td>Branch Recommendation</td>
				</tr>
			</tbody></table>
			
			
			<div class="control-group">
				<label class="control-label" style="text-align:left">Choose a Type</label>
				<div class="controls">
					<select id="business_type" name="business_type" style="width:auto">
					<%
						String html = "<option value=\"\"></option>"
								+ "<option value=\"For Private Limited Company\">For Private Limited Company</option>"
								+ "<option value=\"For Sole Proprietor & Partnership\">For Sole Proprietor & Partnership</option>"
								+ "<option value=\"For Clinic\">For Clinic</option>"
								+ "<option value=\"For JMB\">For JMB</option>"
								+ "<option value=\"For Law Firm\">For Law Firm</option>"
								+ "<option value=\"For Association, Charity Body, etc\">For Association, Charity Body, etc</option>";
						
						html = html.replace("value=\"" + business_type + "\"", "value=\"" + business_type + "\" selected ");
						out.println(html);
					%>
					</select>
				</div>
			</div>
			
			
			<div class="document">
				<% 
					String active = business_type.equals("For Private Limited Company") ? "active" : "";
					String comment = "";
				%>
				<table class="tbl private_limited <%=active %>" style="width:auto;"><thead>
					<tr>
						<th colspan="2">Original CTC</th>
						<th colspan="2">Not Original CTC (With Original Sighted)</th>
						<th rowspan="2">Document Name</th>
					</tr>
					<tr>
						<th style="width:90px">Not Required</th>
						<th style="width:70px">Available</th>
						<th style="width:90px">Not Required</th>
						<th style="width:70px">Available</th>
					</tr>
				</thead><tbody>
					<tr data-name="Form 24">
						<% 
							String checked_b_1 = "";
							String checked_b_2 = "";
							checked = "";
							checked2 = "";
							name = "Form 24";
							item = null;
							
							if(private_limited.get(name) != null){
								item = (JSONObject) private_limited.get(name);
								
								if(item.get("not_required_1").toString().equals("Y")){
									checked = "checked ";
								}
								
								if(item.get("available_1").toString().equals("Y")){
									checked2 = "checked ";
								}
								
								if(item.get("not_required_2").toString().equals("Y")){
									checked_b_1 = "checked ";
								}
								
								if(item.get("available_2").toString().equals("Y")){
									checked_b_2 = "checked ";
								}
							}
						%>
						<td class="a not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
						<td class="a available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
						<td class="b not_required"><input class="checkbox" type="checkbox" <%=checked_b_1 %> value="Y" /></td>
						<td class="b available"><input class="checkbox" type="checkbox" <%=checked_b_2 %> value="Y" /></td>
						<td>Form 24</td>
					</tr>
					<tr data-name="Form 49">
						<% 
							checked_b_1 = "";
							checked_b_2 = "";
							checked = "";
							checked2 = "";
							name = "Form 49";
							item = null;
							
							if(private_limited.get(name) != null){
								item = (JSONObject) private_limited.get(name);
								
								if(item.get("not_required_1").toString().equals("Y")){
									checked = "checked ";
								}
								
								if(item.get("available_1").toString().equals("Y")){
									checked2 = "checked ";
								}
								
								if(item.get("not_required_2").toString().equals("Y")){
									checked_b_1 = "checked ";
								}
								
								if(item.get("available_2").toString().equals("Y")){
									checked_b_2 = "checked ";
								}
							}
						%>
						<td class="a not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
						<td class="a available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
						<td class="b not_required"><input class="checkbox" type="checkbox" <%=checked_b_1 %> value="Y" /></td>
						<td class="b available"><input class="checkbox" type="checkbox" <%=checked_b_2 %> value="Y" /></td>
						<td>Form 49</td>
					</tr>
					<tr data-name="M&A">
						<% 
							checked_b_1 = "";
							checked_b_2 = "";
							checked = "";
							checked2 = "";
							name = "M&A";
							item = null;
							
							if(private_limited.get(name) != null){
								item = (JSONObject) private_limited.get(name);
								
								if(item.get("not_required_1").toString().equals("Y")){
									checked = "checked ";
								}
								
								if(item.get("available_1").toString().equals("Y")){
									checked2 = "checked ";
								}
								
								if(item.get("not_required_2").toString().equals("Y")){
									checked_b_1 = "checked ";
								}
								
								if(item.get("available_2").toString().equals("Y")){
									checked_b_2 = "checked ";
								}
							}
						%>
						<td class="a not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
						<td class="a available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
						<td class="b not_required"><input class="checkbox" type="checkbox" <%=checked_b_1 %> value="Y" /></td>
						<td class="b available"><input class="checkbox" type="checkbox" <%=checked_b_2 %> value="Y" /></td>
						<td>M&A</td>
					</tr>
				</tbody></table>
				
				
				<div class="private_limited control-group <%=active %>" style="margin-top:10px">
					<%
						comment = "";	
						if(private_limited.get("remarks") != null) {
							comment = private_limited.get("remarks").toString();
						}
					%>
					<p>Remarks</p>
					<textarea style="width:600px; height:60px"><%= comment %></textarea>
				</div>
				
				
				
				<% 
					active = business_type.equals("For Sole Proprietor & Partnership") ? "active" : "";
				%>
				<table class="tbl sole_proprietor_partnership <%=active %>" style="width:auto;"><thead>
					<tr>
						<th colspan="2">Original Sighted</th>
						<th colspan="2">Not Original Sighted</th>
						<th rowspan="2">Document Name</th>
					</tr>
					<tr>
						<th style="width:90px">Not Required</th>
						<th style="width:70px">Available</th>
						<th style="width:90px">Not Required</th>
						<th style="width:70px">Available</th>
					</tr>
				</thead><tbody>
					<tr data-name="Borang D/E">
						<% 
							checked_b_1 = "";
							checked_b_2 = "";
							checked = "";
							checked2 = "";
							name = "Borang D/E";
							item = null;
							
							if(sole_proprietor_partnership.get(name) != null){
								item = (JSONObject) sole_proprietor_partnership.get(name);
								
								if(item.get("not_required_1").toString().equals("Y")){
									checked = "checked ";
								}
								
								if(item.get("available_1").toString().equals("Y")){
									checked2 = "checked ";
								}
								
								if(item.get("not_required_2").toString().equals("Y")){
									checked_b_1 = "checked ";
								}
								
								if(item.get("available_2").toString().equals("Y")){
									checked_b_2 = "checked ";
								}
							}
						%>
						<td class="a not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
						<td class="a available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
						<td class="b not_required"><input class="checkbox" type="checkbox" <%=checked_b_1 %> value="Y" /></td>
						<td class="b available"><input class="checkbox" type="checkbox" <%=checked_b_2 %> value="Y" /></td>
						<td>Borang D/E</td>
					</tr>
					<tr data-name="NRIC Copy">
						<% 
							checked_b_1 = "";
							checked_b_2 = "";
							checked = "";
							checked2 = "";
							name = "NRIC Copy";
							item = null;
							
							if(sole_proprietor_partnership.get(name) != null){
								item = (JSONObject) sole_proprietor_partnership.get(name);
								
								if(item.get("not_required_1").toString().equals("Y")){
									checked = "checked ";
								}
								
								if(item.get("available_1").toString().equals("Y")){
									checked2 = "checked ";
								}
								
								if(item.get("not_required_2").toString().equals("Y")){
									checked_b_1 = "checked ";
								}
								
								if(item.get("available_2").toString().equals("Y")){
									checked_b_2 = "checked ";
								}
							}
						%>
						<td class="a not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
						<td class="a available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
						<td class="b not_required"><input class="checkbox" type="checkbox" <%=checked_b_1 %> value="Y" /></td>
						<td class="b available"><input class="checkbox" type="checkbox" <%=checked_b_2 %> value="Y" /></td>
						<td>NRIC Copy</td>
					</tr>
					<tr data-name="Business Registration Form (Sijil Pendaftaran)">
						<% 
							checked_b_1 = "";
							checked_b_2 = "";
							checked = "";
							checked2 = "";
							name = "Business Registration Form (Sijil Pendaftaran)";
							item = null;
							
							if(sole_proprietor_partnership.get(name) != null){
								item = (JSONObject) sole_proprietor_partnership.get(name);
								
								if(item.get("not_required_1").toString().equals("Y")){
									checked = "checked ";
								}
								
								if(item.get("available_1").toString().equals("Y")){
									checked2 = "checked ";
								}
								
								if(item.get("not_required_2").toString().equals("Y")){
									checked_b_1 = "checked ";
								}
								
								if(item.get("available_2").toString().equals("Y")){
									checked_b_2 = "checked ";
								}
							}
						%>
						<td class="a not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
						<td class="a available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
						<td class="b not_required"><input class="checkbox" type="checkbox" <%=checked_b_1 %> value="Y" /></td>
						<td class="b available"><input class="checkbox" type="checkbox" <%=checked_b_2 %> value="Y" /></td>
						<td>Business Registration Form (Sijil Pendaftaran)</td>
					</tr>
					<tr data-name="Extract of Registration of Business Name (Applicable to Sarawak)">
						<% 
							checked_b_1 = "";
							checked_b_2 = "";
							checked = "";
							checked2 = "";
							name = "Extract of Registration of Business Name (Applicable to Sarawak)";
							item = null;
							
							if(sole_proprietor_partnership.get(name) != null){
								item = (JSONObject) sole_proprietor_partnership.get(name);
								
								if(item.get("not_required_1").toString().equals("Y")){
									checked = "checked ";
								}
								
								if(item.get("available_1").toString().equals("Y")){
									checked2 = "checked ";
								}
								
								if(item.get("not_required_2").toString().equals("Y")){
									checked_b_1 = "checked ";
								}
								
								if(item.get("available_2").toString().equals("Y")){
									checked_b_2 = "checked ";
								}
							}
						%>
						<td class="a not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
						<td class="a available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
						<td class="b not_required"><input class="checkbox" type="checkbox" <%=checked_b_1 %> value="Y" /></td>
						<td class="b available"><input class="checkbox" type="checkbox" <%=checked_b_2 %> value="Y" /></td>
						<td>Extract of Registration of Business Name (Applicable to Sarawak)</td>
					</tr>
				</tbody></table>
				
				
				<div class="sole_proprietor_partnership control-group <%=active %>" style="margin-top:10px">
					<%
						comment = "";	
						if(sole_proprietor_partnership.get("remarks") != null) {
							comment = sole_proprietor_partnership.get("remarks").toString();
						}
					%>
					<p>Remarks</p>
					<textarea style="width:600px; height:60px"><%= comment %></textarea>
				</div>
				
				
				<% 
					active = business_type.equals("For Clinic") ? "active" : "";
				%>
				<table class="tbl clinic <%=active %>" style="width:auto;"><thead>
					<tr>
						<th colspan="2">Original Sighted</th>
						<th colspan="2">Not Original Sighted</th>
						<th rowspan="2">Document Name</th>
					</tr>
					<tr>
						<th style="width:90px">Not Required</th>
						<th style="width:70px">Available</th>
						<th style="width:90px">Not Required</th>
						<th style="width:70px">Available</th>
					</tr>
				</thead><tbody>
					<tr data-name="Akta Kemudahan Dan Perkhidmatan Jagaan Kesihatan Swasta (Borang B/C/F)">
						<% 
							checked_b_1 = "";
							checked_b_2 = "";
							checked = "";
							checked2 = "";
							name = "Akta Kemudahan Dan Perkhidmatan Jagaan Kesihatan Swasta (Borang B/C/F)";
							item = null;
							
							if(clinic.get(name) != null){
								item = (JSONObject) clinic.get(name);
								
								if(item.get("not_required_1").toString().equals("Y")){
									checked = "checked ";
								}
								
								if(item.get("available_1").toString().equals("Y")){
									checked2 = "checked ";
								}
								
								if(item.get("not_required_2").toString().equals("Y")){
									checked_b_1 = "checked ";
								}
								
								if(item.get("available_2").toString().equals("Y")){
									checked_b_2 = "checked ";
								}
							}
							
						%>
						<td class="a not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
						<td class="a available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
						<td class="b not_required"><input class="checkbox" type="checkbox" <%=checked_b_1 %> value="Y" /></td>
						<td class="b available"><input class="checkbox" type="checkbox" <%=checked_b_2 %> value="Y" /></td>
						<td>Akta Kemudahan Dan Perkhidmatan Jagaan Kesihatan Swasta (Borang B/C/F)</td>
					</tr>
					<tr data-name="NRIC Copy">
						<% 
							checked_b_1 = "";
							checked_b_2 = "";
							checked = "";
							checked2 = "";
							name = "NRIC Copy";
							item = null;
							
							if(clinic.get(name) != null){
								item = (JSONObject) clinic.get(name);
								
								if(item.get("not_required_1").toString().equals("Y")){
									checked = "checked ";
								}
								
								if(item.get("available_1").toString().equals("Y")){
									checked2 = "checked ";
								}
								
								if(item.get("not_required_2").toString().equals("Y")){
									checked_b_1 = "checked ";
								}
								
								if(item.get("available_2").toString().equals("Y")){
									checked_b_2 = "checked ";
								}
							}
						%>
						<td class="a not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
						<td class="a available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
						<td class="b not_required"><input class="checkbox" type="checkbox" <%=checked_b_1 %> value="Y" /></td>
						<td class="b available"><input class="checkbox" type="checkbox" <%=checked_b_2 %> value="Y" /></td>
						<td>NRIC Copy</td>
					</tr>
					<tr data-name="Perakuan Amalan Tahunan">
						<% 
							checked_b_1 = "";
							checked_b_2 = "";
							checked = "";
							checked2 = "";
							name = "Perakuan Amalan Tahunan";
							item = null;
							
							if(clinic.get(name) != null){
								item = (JSONObject) clinic.get(name);
								
								if(item.get("not_required_1").toString().equals("Y")){
									checked = "checked ";
								}
								
								if(item.get("available_1").toString().equals("Y")){
									checked2 = "checked ";
								}
								
								if(item.get("not_required_2").toString().equals("Y")){
									checked_b_1 = "checked ";
								}
								
								if(item.get("available_2").toString().equals("Y")){
									checked_b_2 = "checked ";
								}
							}
						%>
						<td class="a not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
						<td class="a available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
						<td class="b not_required"><input class="checkbox" type="checkbox" <%=checked_b_1 %> value="Y" /></td>
						<td class="b available"><input class="checkbox" type="checkbox" <%=checked_b_2 %> value="Y" /></td>
						<td>Perakuan Amalan Tahunan</td>
					</tr>
				</tbody></table>
				
				<div class="clinic control-group <%=active %>" style="margin-top:10px">
					<%
						comment = "";	
						if(clinic.get("remarks") != null) {
							comment = clinic.get("remarks").toString();
						}
					%>
					<p>Remarks</p>
					<textarea style="width:600px; height:60px"><%= comment %></textarea>
				</div>
				
				
				<% 
					active = business_type.equals("For JMB") ? "active" : "";
				%>
				<table class="tbl jmb <%=active %>" style="width:auto;"><thead>
					<tr>
						<th colspan="2">Original Sighted</th>
						<th colspan="2">Not Original Sighted</th>
						<th rowspan="2">Document Name</th>
					</tr>
					<tr>
						<th style="width:90px">Not Required</th>
						<th style="width:70px">Available</th>
						<th style="width:90px">Not Required</th>
						<th style="width:70px">Available</th>
					</tr>
				</thead><tbody>
					<tr data-name="Perakuan Penubuhan Badan Pengurusan Bersama">
						<% 
							checked_b_1 = "";
							checked_b_2 = "";
							checked = "";
							checked2 = "";
							name = "Perakuan Penubuhan Badan Pengurusan Bersama";
							item = null;
							
							if(jmb.get(name) != null){
								item = (JSONObject) jmb.get(name);
								
								if(item.get("not_required_1").toString().equals("Y")){
									checked = "checked ";
								}
								
								if(item.get("available_1").toString().equals("Y")){
									checked2 = "checked ";
								}
								
								if(item.get("not_required_2").toString().equals("Y")){
									checked_b_1 = "checked ";
								}
								
								if(item.get("available_2").toString().equals("Y")){
									checked_b_2 = "checked ";
								}
							}
						%>
						<td class="a not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
						<td class="a available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
						<td class="b not_required"><input class="checkbox" type="checkbox" <%=checked_b_1 %> value="Y" /></td>
						<td class="b available"><input class="checkbox" type="checkbox" <%=checked_b_2 %> value="Y" /></td>
						<td>Perakuan Penubuhan Badan Pengurusan Bersama</td>
					</tr>
					<tr data-name="NRIC Copy">
						<% 
							checked_b_1 = "";
							checked_b_2 = "";
							checked = "";
							checked2 = "";
							name = "NRIC Copy";
							item = null;
							
							if(jmb.get(name) != null){
								item = (JSONObject) jmb.get(name);
								
								if(item.get("not_required_1").toString().equals("Y")){
									checked = "checked ";
								}
								
								if(item.get("available_1").toString().equals("Y")){
									checked2 = "checked ";
								}
								
								if(item.get("not_required_2").toString().equals("Y")){
									checked_b_1 = "checked ";
								}
								
								if(item.get("available_2").toString().equals("Y")){
									checked_b_2 = "checked ";
								}
							}
						%>
						<td class="a not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
						<td class="a available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
						<td class="b not_required"><input class="checkbox" type="checkbox" <%=checked_b_1 %> value="Y" /></td>
						<td class="b available"><input class="checkbox" type="checkbox" <%=checked_b_2 %> value="Y" /></td>
						<td>NRIC Copy</td>
					</tr>
					<tr data-name="Minutes of Meeting / List of Committee">
						<% 
							checked_b_1 = "";
							checked_b_2 = "";
							checked = "";
							checked2 = "";
							name = "Minutes of Meeting / List of Committee";
							item = null;
							
							if(jmb.get(name) != null){
								item = (JSONObject) jmb.get(name);
								
								if(item.get("not_required_1").toString().equals("Y")){
									checked = "checked ";
								}
								
								if(item.get("available_1").toString().equals("Y")){
									checked2 = "checked ";
								}
								
								if(item.get("not_required_2").toString().equals("Y")){
									checked_b_1 = "checked ";
								}
								
								if(item.get("available_2").toString().equals("Y")){
									checked_b_2 = "checked ";
								}
							}
						%>
						<td class="a not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
						<td class="a available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
						<td class="b not_required"><input class="checkbox" type="checkbox" <%=checked_b_1 %> value="Y" /></td>
						<td class="b available"><input class="checkbox" type="checkbox" <%=checked_b_2 %> value="Y" /></td>
						<td>Minutes of Meeting / List of Committee</td>
					</tr>
				</tbody></table>
				
				
				<div class="jmb control-group <%=active %>" style="margin-top:10px">
					<%
						comment = "";	
						if(jmb.get("remarks") != null) {
							comment = jmb.get("remarks").toString();
						}
					%>
					<p>Remarks</p>
					<textarea style="width:600px; height:60px"><%= comment %></textarea>
				</div>
				
				
				<% 
					active = business_type.equals("For Law Firm") ? "active" : "";
				%>
				<table class="tbl law_firm <%=active %>" style="width:auto;"><thead>
					<tr>
						<th colspan="2">Original Sighted</th>
						<th colspan="2">Not Original Sighted</th>
						<th rowspan="2">Document Name</th>
					</tr>
					<tr>
						<th style="width:90px">Not Required</th>
						<th style="width:70px">Available</th>
						<th style="width:90px">Not Required</th>
						<th style="width:70px">Available</th>
					</tr>
				</thead><tbody>
					<tr data-name="Akta Profession Undang-Undang">
						<% 
							checked_b_1 = "";
							checked_b_2 = "";
							checked = "";
							checked2 = "";
							name = "Akta Profession Undang-Undang";
							item = null;
							
							if(law_firm.get(name) != null){
								item = (JSONObject) law_firm.get(name);
								
								if(item.get("not_required_1").toString().equals("Y")){
									checked = "checked ";
								}
								
								if(item.get("available_1").toString().equals("Y")){
									checked2 = "checked ";
								}
								
								if(item.get("not_required_2").toString().equals("Y")){
									checked_b_1 = "checked ";
								}
								
								if(item.get("available_2").toString().equals("Y")){
									checked_b_2 = "checked ";
								}
							}
						%>
						<td class="a not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
						<td class="a available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
						<td class="b not_required"><input class="checkbox" type="checkbox" <%=checked_b_1 %> value="Y" /></td>
						<td class="b available"><input class="checkbox" type="checkbox" <%=checked_b_2 %> value="Y" /></td>
						<td>Akta Profession Undang-Undang</td>
					</tr>
					<tr data-name="NRIC Copy">
						<% 
							checked_b_1 = "";
							checked_b_2 = "";
							checked = "";
							checked2 = "";
							name = "NRIC Copy";
							item = null;
							
							if(law_firm.get(name) != null){
								item = (JSONObject) law_firm.get(name);
								
								if(item.get("not_required_1").toString().equals("Y")){
									checked = "checked ";
								}
								
								if(item.get("available_1").toString().equals("Y")){
									checked2 = "checked ";
								}
								
								if(item.get("not_required_2").toString().equals("Y")){
									checked_b_1 = "checked ";
								}
								
								if(item.get("available_2").toString().equals("Y")){
									checked_b_2 = "checked ";
								}
							}
						%>
						<td class="a not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
						<td class="a available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
						<td class="b not_required"><input class="checkbox" type="checkbox" <%=checked_b_1 %> value="Y" /></td>
						<td class="b available"><input class="checkbox" type="checkbox" <%=checked_b_2 %> value="Y" /></td>
						<td>NRIC Copy</td>
					</tr>
				</tbody></table>
				
				<div class="law_firm control-group <%=active %>" style="margin-top:10px">
					<%
						comment = "";	
						if(law_firm.get("remarks") != null) {
							comment = law_firm.get("remarks").toString();
						}
					%>
					<p>Remarks</p>
					<textarea style="width:600px; height:60px"><%= comment %></textarea>
				</div>
				
				
				<% 
					active = business_type.equals("For Association, Charity Body, etc") ? "active" : "";
				%>
				
				<table class="tbl association <%=active %>" style="width:auto;"><thead>
					<tr>
						<th style="width:90px">Not Required</th>
						<th style="width:70px">Available</th>
						<th>Document Name</th>
					</tr>
				</thead><tbody>
					<tr data-name="Letter of Registration">
						<% 
							checked = "";
							checked2 = "";
							name = "Letter of Registration";
							item = null;
							
							if(association.get(name) != null){
								item = (JSONObject) association.get(name);
								
								if(item.get("not_required_1").toString().equals("Y")){
									checked = "checked ";
								}
								
								if(item.get("available_1").toString().equals("Y")){
									checked2 = "checked ";
								}
							}
						%>
						<td class="a not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
						<td class="a available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
						<td>Letter of Registration</td>
					</tr>
					<tr data-name="NRIC copy of Authorised Signatories">
						<% 
							checked = "";
							checked2 = "";
							name = "NRIC copy of Authorised Signatories";
							item = null;
							
							if(association.get(name) != null){
								item = (JSONObject) association.get(name);
								
								if(item.get("not_required_1").toString().equals("Y")){
									checked = "checked ";
								}
								
								if(item.get("available_1").toString().equals("Y")){
									checked2 = "checked ";
								}
							}
						%>
						<td class="a not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
						<td class="a available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
						<td>NRIC copy of Authorised Signatories</td>
					</tr>
					<tr data-name="Minutes of Meeting / List of Committee">
						<% 
							checked = "";
							checked2 = "";
							name = "Minutes of Meeting / List of Committee";
							item = null;
							
							if(association.get(name) != null){
								item = (JSONObject) association.get(name);
								
								if(item.get("not_required_1").toString().equals("Y")){
									checked = "checked ";
								}
								
								if(item.get("available_1").toString().equals("Y")){
									checked2 = "checked ";
								}
							}
						%>
						<td class="a not_required"><input class="checkbox" type="checkbox" <%=checked %> value="Y" /></td>
						<td class="a available"><input class="checkbox" type="checkbox" <%=checked2 %> value="Y" /></td>
						<td>Minutes of Meeting / List of Committee</td>
					</tr>
				</tbody></table>
				
				<div class="association control-group <%=active %>" style="margin-top:10px">
					<%
						comment = "";	
						if(association.get("remarks") != null) {
							comment = association.get("remarks").toString();
						}
					%>
					<p>Remarks</p>
					<textarea style="width:600px; height:60px"><%= comment %></textarea>
				</div>
				
			</div>
			
			<div class="btn-control">
				<input id="click_redirect" name="click_redirect" type="hidden" value="" />
				<button id="submit" type="button" class="btn" onclick="merchant.create_document_checklist('<%= EncryptionHelper.encrypt(merchant_id+"") %>', '<%= EncryptionHelper.encrypt(case_id+"") %>', false)">Save</button>
				<button id="notify" type="button" class="btn" onclick="merchant.create_document_checklist('<%= EncryptionHelper.encrypt(merchant_id+"") %>', '<%= EncryptionHelper.encrypt(case_id+"") %>', true)">Notify via Email</button>
			</div>
			
		</form>
		
	</div>
</div>

<!-- Footer -->
<%@ include file="/jsp/common/Footer.jsp" %>	
<!-- End Footer -->

</body>
</html>